import fs from 'node:fs'
import { execa } from 'execa'

async function build(target) {

  fs.rmSync(`packages/${target}/dist/`, { recursive: true, force: true }) // 删除 dist 目录下的所有文件
  
  execa(`rollup`, ['-cw', '--environment', `TARGET:${target}`], {
    stdio: 'inherit', // 子进程打包的信息，在父进程中打印
  })
  
}

build('shared')
build('reactivity')
build('runtime-core')
build('runtime-dom')

